#对话管理模块
class DialogueManager:
    def __init__(self):
        self.sessions = {}

    def get_context(self, user_id):
        return self.sessions.get(user_id, [])

    def append_turn(self, user_id, question, answer):
        if user_id not in self.sessions:
            self.sessions[user_id] = []
        self.sessions[user_id].append({'question': question, 'answer': answer}) 